package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                            import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.BankCodeMapper;
import com.ruoyi.bizsys.domain.BankCode;
import com.ruoyi.bizsys.service.IBankCodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 银行编码Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class BankCodeServiceImpl extends ServiceImpl<BankCodeMapper,BankCode> implements IBankCodeService {

    /**
     * 查询银行编码
     *
     * @param id 银行编码ID
     * @return 银行编码
     */
    @Override
    public BankCode selectBankCodeById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询银行编码列表
     *
     * @param bankCode 银行编码
     * @return 银行编码
     */
    @Override
    public List<BankCode> selectBankCodeList(BankCode bankCode) {
        return this.list(new QueryWrapper<>(bankCode).last("order by id desc"));
    }

    /**
     * 新增银行编码
     *
     * @param bankCode 银行编码
     * @return 结果
     */
            @Override
    public int insertBankCode(BankCode bankCode) {
                                                                                                                                                                                                                                                                                                                                                                    bankCode.setCreateTime(DateUtils.getNowDate());
                            return baseMapper.insert(bankCode);
    }

    /**
     * 修改银行编码
     *
     * @param bankCode 银行编码
     * @return 结果
     */
            @Override
    public int updateBankCode(BankCode bankCode) {
                                                                                                                                                                                                                                                                                                                            bankCode.setUpdateTime(DateUtils.getNowDate());
                                                                    return baseMapper.updateById(bankCode);
    }

    /**
     * 批量删除银行编码
     *
     * @param ids 需要删除的银行编码ID
     * @return 结果
     */
            @Override
    public int deleteBankCodeByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除银行编码信息
     *
     * @param id 银行编码ID
     * @return 结果
     */
    @Override
    public int deleteBankCodeById(Long id) {
        return baseMapper.deleteById(id);
    }

}
